package megrez.job.custom.domain;

import org.springframework.data.jpa.domain.Specification;

import lombok.experimental.UtilityClass;

/**
 * 查询条件
 * 
 * @author Lucky Yang
 * @since 2.6.9
 */
@UtilityClass
public class ConfigSpecifications {
    public Specification<Config> empty() {
        return (root, query, builder) -> null;
    }

    public Specification<Config> classNameLike(String className) {
        return (root, query, builder) -> builder.like(root.get("className"), "%" + className + "%");
    }

    public Specification<Config> enabledEqual(Boolean enabled) {
        return (root, query, builder) -> builder.equal(root.get("enabled"), enabled);
    }
}
